<jsp:include page="header.jsp">
			<jsp:param value="item2" name="item"/>
</jsp:include> 
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<section class="content">
	<section class="widget">
		<header>
			<span class="icon">&#128196;</span>
			<hgroup>
				<h1>用户组管理</h1>
				<h2>用户组列表</h2>
			</hgroup>
		</header>
		<div class="content">
				<div id="baseInfo">
					<input type="button" id="addItem" class="button white" value="增加"/><br/><br/>	
					<s:if test="userGroupList!=null && userGroupList.size!=0">
						<table id="myTable">
					    	<tr>

					    		<!--<th>用户组编号</th>
					    		--><th>组名</th>
					    		<th>标准</th>			
					    		<th>操作</th>
					    	</tr>
					    	<s:iterator value="userGroupList" id="row" status="state">
					    	
							    <tr>
							    <s:form action="updateUserGroup" method="post">
							    	<!--<td><input type="text" name="userGroup.userGroupId" readonly="readonly"  value=<s:property value="#row.userGroupId"/> /></td>
							    	--><td><input type="text" name="userGroup.userGroupName"   value=<s:property value="#row.userGroupName"/> 
							    			minlength="1" maxlength="45" required="required"/></td>
							    	
							    	<td>
							    	<s:if test='#row.travelStandard == null'>
							    		<s:select name="userGroup.travelStandard.standardId" list="travelStandardList.{?#this.standardId != null}" listKey="standardId" listValue="grade"
							    		headerKey="" headerValue="" value="travelStandard.standardId"/>
							    	</s:if>
							    	<s:else>
							    		<s:select name="userGroup.travelStandard.standardId" list="travelStandardList.{?#this.standardId != #row.travelStandard.standardId}" listKey="standardId" listValue="grade"
							    		headerKey="%{#row.travelStandard.standardId}" headerValue="%{#row.travelStandard.grade}"
							    		value="travelStandard.standardId"/>
							    	</s:else>
							    	
							    	 </td>	
							    	 <td>
							    	 	<input type="hidden" name="userGroup.userGroupId"  value=<s:property value="#row.userGroupId"/> />
							    	 	<input type="submit" formaction="deleteUserGroup" class="button white" value="删除" />
				    					<input type="submit"  class="button white" value="修改"/>
							    	 </td>	
							    	 </s:form> 				
							    </tr>
							 	
						    </s:iterator>
					    </table>
						</s:if>
						<s:else>
							<p>尚无用户组！！</p><br/>
						</s:else>
						<%-- <div id="pageLinks">
							<s:url id="url_pre" value="getAlluserGroupInfo.action">  
					        	<s:param name="pageNow" value="pageNow-1"></s:param>  
						    </s:url>  
						  	<s:url id="url_next" value="getAlluserGroupInfo.action">  
					        	<s:param name="pageNow" value="pageNow+1"></s:param>  
						    </s:url>
					  		<s:if test="pageNow==1">
						  		<s:a href="">第一页</s:a>
						  		<s:bean name= "org.apache.struts2.util.Counter"  id= "counter" >     
								  <s:param name="first"  value= "1"  />     
								  <s:param name="last"  value= "pageNum"  />     
								  <s:iterator>
								   	<a href="getAlluserGroupInfo.action?pageNow=<s:property/>" ><s:property/></a>      	    
								  </s:iterator>     
								</s:bean>    
						    	<s:a href="%{url_next}">下一页</s:a> 
						    </s:if>
						    <s:elseif test="pageNow==pageNum">
						    	<s:a href="%{url_pre}">上一页</s:a>
						    	<s:bean name= "org.apache.struts2.util.Counter"  id= "counter" >     
								  <s:param name="first"  value= "1"  />     
								  <s:param name="last"  value= "pageNum"  />     
								  <s:iterator>
								   	<a href="getAlluserGroupInfo.action?pageNow=<s:property/>" ><s:property/></a>      	    
								  </s:iterator>     
								</s:bean> 
						    	<s:a href="">最后一页</s:a>
						    </s:elseif>
						    <s:else>
						    	<s:a href="%{url_pre}">上一页</s:a>
						    	<s:bean name= "org.apache.struts2.util.Counter"  id= "counter" >     
								  <s:param name="first"  value= "1"  />     
								  <s:param name="last"  value= "pageNum"  />     
								  <s:iterator>
								   	<a href="getAlluserGroupInfo.action?pageNow=<s:property/>" ><s:property/></a>      	    
								  </s:iterator>     
								</s:bean>  
						    	<s:a href="%{url_next}">下一页</s:a>
						    </s:else>
						</div> --%>
      
				
					    
	
					    <div id="popup" class="hide">
					    	<form id="reg-form" action="addUserGroup" method="post">
	
						        <table>
									<tr>
										<td>组名</td>
										<td><input name="userGroup.userGroupName" type="text" id="userGroupName" maxlength="45" required="required"/></td>
									</tr>
									<tr>
										<td>标准</td>
										<td>
										<s:select name="userGroup.travelStandard.standardId" list="travelStandardList" listKey="standardId" listValue="grade" />
										</td>
									</tr>
							
									
								</table>
	
								<div class="buttons">
									<input value="完成" type="submit" class="button white">
									<input value="重置" type="reset" class="button white">
						        </div>
						    </form>
				</div>
			</div>
			</div>
	</section>
	<script type="text/javascript">

		var addItem = document.getElementById("addItem");

	
		//添加信息
		addItem.onclick=function(){
				 
			 layer.open({
		        type: 1,
		        skin:'layui-layer-lan',
		        area: ['360px', '270px'],
		        shadeClose: true, //点击遮罩关闭
		        content: $('#popup')
		    });
	    }
	    
	  
	     var message="<%=request.getAttribute("message")%>";
				   if(message!="null"){
						alert(message);
					}
	</script>
<%@ include file="footer.jsp" %>